
#include <Servo.h>
Servo ESC;     // create servo object to control the ESC
int potValue;  // value from the analog pin

void setup() {
  // Attach the ESC on pin 9
  ESC.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds)
  ESC.write(0);  
  delay(3000);

}

void loop() {

  for (potValue = 0 ; potValue <= 180; potValue += 1) {
    // sets the value (range from 0 to 180):
    ESC.write(potValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);}

     for (potValue = 180 ; potValue >= 0; potValue -= 1) {
    // sets the value (range from 0 to 255):
    ESC.write(potValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);}
}